package cn.tedu.charging.user.service.impl;

import cn.tedu.charging.common.pojo.vo.UserInfoVO;
import cn.tedu.charging.user.dao.mapper.UserVehicleBindMapper;
import cn.tedu.charging.user.pojo.po.ChargingUserVehiclePO;
import cn.tedu.charging.user.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserVehicleBindMapper userVehicleBindMapper;

    @Override
    public UserInfoVO getUserInfo(Integer userId) {
        QueryWrapper queryMapper = new QueryWrapper();
        queryMapper.eq("user_id",userId);
        queryMapper.eq("state",1);
        ChargingUserVehiclePO chargingUserVehiclePO = userVehicleBindMapper.selectOne(queryMapper);
        UserInfoVO userInfoVO = new UserInfoVO();
        userInfoVO.setCarId(chargingUserVehiclePO.getVehicleId());
        return userInfoVO;
    }
}
